// {
//   name: '名称',
//   explain: '说明',
//   type: '类型',
//   option: '可选值',
//   defaultOrParam: '默认值/参数',
//
//   children: []
// }

const tableData = [
  {
    name: 'Params（变量）',
    explain: '-',
    type: '-',
    option: '-',
    defaultOrParam: '-',
    param: '-',
    children: [
      {
        name: 'urlInfo',
        explain: 'info、data接口信息,',
        type: 'Object',
        option: '-',
        defaultOrParam: '-',
        param: '-',
      },
      {
        name: 'option',
        explain: '组件配置',
        type: 'Object',
        option: '-',
        defaultOrParam: '-',
        param: '-',
        children: [
          {
            name: 'tableOption',
            explain: '表格配置',
            type: 'Object',
            option: '-',
            defaultOrParam: '-',
            children: [
              {
                name: 'height',
                explain:
                  '表格高度,\n auto-铺满整个父元素，且没有其他兄弟元素,\n none-不指定高度，随着内容增加而增加',
                type: 'String',
                option: 'auto, %, px, none',
                defaultOrParam: 'auto',
              },
              {
                name: 'lineHeight',
                explain: '表格行高',
                type: 'Number',
                option: '30 - infinite',
                defaultOrParam: '40',
              },
              {
                name: 'seq',
                explain: '显示序号列',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'checkbox',
                explain: '表格复选框',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'menuWidth',
                explain: '表格操作列宽度',
                type: 'Number',
                option: '-',
                defaultOrParam: '200',
              },
              {
                name: 'menuFixed',
                explain: '表格操作列冻结',
                type: 'String',
                option: 'left,right,none',
                defaultOrParam: 'right',
              },
              {
                name: 'menu',
                explain: '显示操作栏',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'resizable',
                explain: '列宽度拖拽',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'stripe',
                explain: '斑马线条纹',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'isHover',
                explain: '鼠标悬浮高亮',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'isCurrent',
                explain: '单选高亮行',
                type: 'Boolean',
                option: '-',
                defaultOrParam: 'true',
              },
              {
                name: 'align',
                explain: '列的对齐方式',
                type: 'String',
                option: 'left,center,right',
                defaultOrParam: '默认值/参数',
              },
              {
                name: 'headerAlign',
                explain: '表头列的对齐方式',
                type: 'String',
                option: 'left,center,right',
                defaultOrParam: '继承 align',
              },
            ],
          },
          {
            name: 'showSearch',
            explain: '显示搜索栏',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'showToolbar',
            explain: '显示工具栏',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'showPage',
            explain: '显示分页栏',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'addBtn',
            explain: '新增按钮',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'delBtn',
            explain: '删除按钮',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'editBtn',
            explain: '编辑按钮',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'refreshBtn',
            explain: '刷新按钮',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'configLocalDisplay',
            explain: '配置抽屉局部显示',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'tableTabMenu',
            explain: '显示表格tab切换菜单',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'initialLoad',
            explain: '是否默认加载',
            type: 'Boolean',
            option: '-',
            defaultOrParam: 'true',
          },
          {
            name: 'searchMenuSpan',
            explain: '搜索框按钮宽度',
            type: 'Number',
            option: '1-24',
            defaultOrParam: '4',
          },
        ],
      },
      {
        name: 'custom-request-param',
        explain: '外部自定义请求参数',
        type: 'Object',
        option: '-',
        defaultOrParam: '-',
        param: '-',
      },
      {
        name: 'search',
        explain: '当前搜索参数，配合.sync语法糖使用',
        type: 'Object',
        option: '-',
        defaultOrParam: '-',
        param: '-',
      },
      {
        name: 'request',
        explain: 'ajax请求方法',
        type: 'Function',
        option: '-',
        defaultOrParam: '-',
        param: '-',
      },
    ],
  },
  {
    name: 'Event（事件）',
    explain: '-',
    type: '-',
    option: '-',
    defaultOrParam: '-',
    param: '-',
    children: [
      {
        name: 'checkbox-change',
        explain: '当手动勾选并且值发生改变时触发的事件',
        type: '-',
        option: '-',
        defaultOrParam:
          '	{ checked, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }',
      },
      {
        name: 'current-change',
        explain: '当手动选中行并且值发生改变时触发的事件',
        type: '-',
        option: '-',
        defaultOrParam:
          '{ newValue, oldValue, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }',
      },
      {
        name: 'add',
        explain: '点击 工具栏-新增 按钮的事件',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },
      {
        name: 'remove',
        explain: '点击 工具栏-删除 按钮的事件',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },
      {
        name: 'handle-update',
        explain: '点击 表格操作-编辑 按钮的事件',
        type: '-',
        option: '-',
        defaultOrParam: 'row',
      },
      {
        name: 'handle-delete',
        explain: '点击 表格操作-删除 按钮的事件',
        type: '-',
        option: '-',
        defaultOrParam: 'row',
      },
      {
        name: 'tab-change',
        explain: '表格tab切换事件',
        type: '',
        option: '',
        defaultOrParam: 'tab',
      },
      {
        name: 'checkbox-all',
        explain: '手动勾选全选时触发的事件',
        type: '-',
        option: '-',
        defaultOrParam: '{ checked, records }',
      },
      {
        name: 'update-data',
        explain: 'Data接口获取完成的事件',
        type: '-',
        option: '-',
        defaultOrParam: '{ data, done, loading, first }',
      },
      {
        name: 'option-init',
        explain: 'option接口首次加载完成的事件',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },
    ],
  },
  {
    name: 'Slot（插槽）',
    explain: '-',
    type: '-',
    option: '-',
    defaultOrParam: '-',
    param: '-',
    children: [
      {
        name: 'search-"搜索项ID"',
        explain: '搜索项插槽',
        type: '-',
        option: '-',
        defaultOrParam: '{value,column,label,row,dic}',
      },
      {
        name: 'table-"tab名称"-"列属性名称"',
        explain: '表格列插槽',
        type: '-',
        option: '-',
        defaultOrParam: '{$columnIndex,$rowIndex,row}',
      },
      {
        name: 'toolbar-menu-left',
        explain: '工具栏左侧插槽',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },
      {
        name: 'table-top',
        explain: '表格顶部插槽',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },

      {
        name: 'table-menu-left',
        explain: '表格操作列左侧插槽',
        type: '-',
        option: '-',
        defaultOrParam: '{$rowIndex,row}',
      },
      {
        name: 'table-menu-right',
        explain: '表格操作列右侧插槽',
        type: '-',
        option: '-',
        defaultOrParam: '{$rowIndex,row}',
      },
    ],
  },
  {
    name: 'Methods（方法）',
    explain: '-',
    type: '-',
    option: '-',
    defaultOrParam: '-',
    param: '-',
    children: [
      {
        name: 'searchData',
        explain: '修改搜索条件并筛选数据',
        type: 'Object',
        option: '-',
        defaultOrParam: 'param',
      },
      {
        name: 'onLoad',
        explain: '刷新数据，可指定搜索条件',
        type: 'Object',
        option: '-',
        defaultOrParam: '{query,isRefresh}',
      },
      {
        name: 'getData',
        explain: '获取当前表格数据，可指定行号rowIndex',
        type: 'Number',
        option: '-',
        defaultOrParam: 'rowIndex',
      },
      {
        name: 'setCheckboxRow',
        explain: '设置行为选中状态，第二个参数为选中与否',
        type: 'Array, Boolean',
        option: '-',
        defaultOrParam: 'rows, checked',
      },
      {
        name: 'getOption',
        explain: '发起info请求，刷新表格配置',
        type: '-',
        option: '-',
        defaultOrParam: '-',
      },
    ],
  },
]

function addId(arr, parentId) {
  arr.forEach((item, index) => {
    item.id = parentId ? parentId + '-' + index : index.toString()
    if (item.children && item.children.length > 0)
      item.children = addId(item.children, item.id)
  })
  return arr
}

export default addId(tableData)
